From c80ed144feb3bcf697e13204207e6863f0e2b9b0 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 26 Jan 2011 11:47:52 +0000 Subject: [PATCH] libxl: only check size of regular files when validating a virtual disk st_size is only valid for regular files and not block devices. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- tools/libxl/libxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 6fee2b1a60..ccbc84218b 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -850,7 +850,7 @@ static int validate_virtual_disk(libxl_ctx *ctx, char *file_name, libxl_disk_phy file_name); return ERROR_INVAL; } - } else if ( stat_buf.st_size == 0 ) { + } else if ( S_ISREG(stat_buf.st_mode) && stat_buf.st_size == 0 ) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual disk %s size is 0!\n", file_name); return ERROR_INVAL; } -- 2.30.2